package cn.tedu.inter2;

public class Test {
    public static void main(String[] args) {
        Teacher t = new Teacher();
        Student s = new Student();
        Parents p = new Parents();
        t.eat();
        t.sleep();
        s.eat();
        s.sleep();
        p.eat();
        p.sleep();
    }
}

//1.定义一个接口，描述人这一类事务
interface Person{
    void eat();
    void sleep();
}

//3.定义一个老师类实现person类
class Teacher implements Person{
    //4.添加接口中未实现的抽象方法
    @Override
    public void eat() {
        System.out.println("老师在教室食堂吃饭");
    }

    @Override
    public void sleep() {
        System.out.println("老师在学校公寓住宿");
    }
}

class Student implements Person{
    @Override
    public void eat() {
        System.out.println("学生在学生食堂吃饭");
    }

    @Override
    public void sleep() {
        System.out.println("学生在宿舍住宿");
    }
}

class Parents implements Person{
    @Override
    public void eat() {
        System.out.println("学生家长在招待所吃饭");
    }

    @Override
    public void sleep() {
        System.out.println("学生家长在招待所睡觉");
    }
}